package com.store.pet.petstore.util;

import android.content.res.Resources;

/**
 * 屏幕工具类
 *
 * @author yangfei
 */
public final class ScreenUtil {

    private ScreenUtil() {
        // 这个类不能实例化
    }

    /**
     * 屏幕宽度
     */
    public static int getScreenWidth() {
        return Resources.getSystem().getDisplayMetrics().widthPixels;
    }

    /**
     * 屏幕高度
     */
    public static int getScreenHeight() {
        return Resources.getSystem().getDisplayMetrics().heightPixels;
    }

    /**
     * 获取状态栏高度
     */
    public static int getStatusBarHeight() {
        int statusBarHeight;
        int resId = Resources.getSystem().getIdentifier("status_bar_height", "dimen", "android");
        if (resId > 0) {
            statusBarHeight = Resources.getSystem().getDimensionPixelSize(resId);
        } else {
            statusBarHeight = DensityUtil.dp2px(24);
        }
        return statusBarHeight;
    }

}